<%@page import="java.time.LocalDateTime"%>
<%@page import="java.time.format.DateTimeFormatter"%>
<%@page import="java.time.format.DateTimeFormatter,java.time.LocalDateTime"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" session="false" errorPage="demo03.jsp"%><%-- 指令：设置翻译 page：页面指令 --%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>demo02</title>
</head>
<body>
<h1>demo02</h1><!-- html的注释 -->
<h2><%=java.time.LocalDateTime.now() %></h2>
<h2><%=this.getClass().getResource("./") %></h2>
<%=request.getHeader("Host") %>
<%
response.setCharacterEncoding("UTF-8");

out.print(true);
//int i=1/0; //异常演示
%><br/>
<%=f.format(LocalDateTime.now()) %><br/>
<%=format(LocalDateTime.now()) %>

</body>
</html>

<%!
	private DateTimeFormatter f = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm");

	private String format(LocalDateTime d) {
		return f.format(d);
	}
%>